{% extends 'AppDashboardBundle::layout2.html.twig' %}

{% block stylesheets %}
  {{ parent() }}
{% endblock %}

{% block javascripts %}      
  {{ parent() }}
<script>
  
$( document ).ready(function() { 
  $( ".datepicker" ).datepicker({ dateFormat: "yy-mm-dd" });
  if($("table.sortable").length>0)
    $("table.sortable").dataTable({
      iDisplayLength:25,
      aLengthMenu:[5,10,25,50,100],
      sPaginationType:"full_numbers",
      aoColumns:[{bSortable:false},null,null,null,null,null,null]
      });
});
  
</script>
</script>
{% endblock %}

{% block content %}
<div class="row"> 
  <div class="col-md-12"> 
    <ol class="breadcrumb"> 
      <li><a href="#">Нүүр</a></li> 
      <li><a href="#">Нийлүүлэлт</a></li> 
    </ol> 
  </div> 
</div>
<div class=row> 
  <div class=col-md-12> 
    <div class=block> 
      <div class=header> <h2>Нийлүүлэлт жагсаалт</h2> </div> 
      <div class=content>
        <form method="POST" name="searchForm" id="searchForm">
          <table>
            <tr>
              <td><input type=text class="datepicker form-control" value="{{beginDate}}" id="beginDate" name="beginDate"/> </td>
              <td>-</td>
              <td><input type=text class="datepicker form-control" value="{{endDate}}" id="endDate" name="endDate"/></td>
              <td><button class="btn btn-success btn-clean" type="submit">Хайх</button></td>
            </tr>
          </table>
           
        </form>
      </div>
      
      <div class=content style="margin: 1px 0;"> 
        <table cellpadding=0 cellspacing=0 width=100% class="table table-bordered table-striped sortable">  
          <thead> 
            <tr>       
              <th rowspan="1">Дүүрэг</th> 
              <th rowspan="1">Дэлгүүр</th> 
              <th rowspan="1">Бүтээгдэхүүн</th> 
              <th rowspan="1">Огноо</th> 
              <th rowspan="1">Тоо</th> 
              <th rowspan="1">Үнэ</th> 
              <th rowspan="1">Нийт</th> 
            </tr> 
          </thead> 
          <tbody> 
            {% set currentDistrictName = '' %}
              {% set currentDistrictTotal = 0 %}
            {% for k, supply in supplyArray %}
              {% if currentDistrictName == supply.DISTRICT %}
                {% set currentDistrictTotal = currentDistrictTotal + supply.TOTAL %}
              {% else %}
                     
                {% set currentDistrictName = supply.DISTRICT %}  
                {% set currentDistrictTotal = supply.TOTAL %}
              {% endif%}
              
              {% set currentDistrictName = supply.DISTRICT %}
            <tr> 
              <td>{{supply.DISTRICT}}</td> 
              <td>{{supply.SHOP_NAME}}</td> 
              <td>{{supply.NAME}}</td>
              <td>{{supply.CREATED_DATE}}</td> 
              <td>{{supply.RUMMAGE}}</td> 
              <td>{{supply.PER_PRICE}}</td> 
              <td>{{supply.TOTAL}}</td> 
            </tr>
            {% endfor %}
            
          </tbody> 
        </table> 
      </div> 
    </div> 
  </div> 
</div> 
{% endblock %}
    